
# -*- coding: utf-8 -*-
# flake8: noqa
import sys

import unittest
# from info2soft import RetentionPolicy
from info2soft.retentionPolicy.v20240819.RetentionPolicy import RetentionPolicy
from info2soft import Auth
from info2soft.fileWriter import write
from info2soft.compat import is_py2, is_py3

if is_py2:
    import sys
    import StringIO
    import urllib

    # reload(sys)
    sys.setdefaultencoding('utf-8')
    StringIO = StringIO.StringIO
    urlopen = urllib.urlopen
if is_py3:
    import io
    import urllib

    StringIO = io.StringIO
    urlopen = urllib.request.urlopen

username = 'admin'
pwd = 'Info@123'


class RetentionPolicyTestCase(unittest.TestCase):

    def testListRetentionPolicy(self):
        a = Auth(username, pwd)
        body = {
        }
        
        
        retentionPolicy = RetentionPolicy(a)
        r = retentionPolicy.listRetentionPolicy(body)
        print(r[0])
        assert r[0]['ret'] == 200
        write(r[0], 'RetentionPolicy', 'listRetentionPolicy', body)

    def testModifyRetentionPoliciy(self):
        a = Auth(username, pwd)
        body = {
            'type': '',
            'value': 1,
            'id': '',
        }
        
        
        retentionPolicy = RetentionPolicy(a)
        r = retentionPolicy.modifyRetentionPoliciy(body)
        print(r[0])
        assert r[0]['ret'] == 200
        write(r[0], 'RetentionPolicy', 'modifyRetentionPoliciy', body)


if __name__ == '__main__':
    unittest.main()
